import React from 'react';
const OutLayout = React.lazy(() => import(/* webpackChunkName: "outLayout" */ '../layout/out-layout'));
const AuthLayout = React.lazy(() => import(/* webpackChunkName: "authLayout" */ '../layout/auth-layout/auth-layout'));
const Login = React.lazy(() => import(/* webpackChunkName: "login" */ '../pages/login'));
const NotFound = React.lazy(() => import(/* webpackChunkName: "notFound" */ '../pages/not-found'));

export const getRouteConfig = (authRoutes: RouteItemProps[] = []) => {
    const routeConfigInner: RouteItemProps[] = [
        {
            path: '/',
            component: OutLayout,
            children: [
                {
                    path: '/login',
                    component: Login,
                },
                {
                    path: '/auth',
                    component: AuthLayout,
                    children: [
                        ...authRoutes,
                        //没有人任何匹配时403
                        {
                            path: '*',
                            needValid: false,
                            component: NotFound,
                        },
                    ],
                },
                {
                    path: '*',
                    component: Login,
                },
            ],
        },
        {
            path: '*',
            component: Login,
        },
    ];
    return routeConfigInner;
};

export const routeConfig: RouteItemProps[] = getRouteConfig([]);
